define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'operation.suggestions/index',
        add_url: 'operation.suggestions/add',
        edit_url: 'operation.suggestions/edit',
        delete_url: 'operation.suggestions/delete',
        export_url: 'operation.suggestions/export',
        modify_url: 'operation.suggestions/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:[],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    // {field: 'user_id', title: '用户'},
                    {field: 'type_name', title: '反馈类型名称'},
                    {field: 'body', title: '内容'},
                    {field: 'thumb', title: '缩略图', templet: ea.table.image},
                    {field: 'contact', title: '联系方式'},
                    {field: 'status', search: 'select', selectList: ea.getDataBrage('select_list_status'), title: '状态', templet: ea.table.switch},
                    {field: 'replay', title: '回复内容'},
                    {field: 'replay_time', title: '回复时间'},
                    {field: 'create_time', title: '反馈时间'},
                    {width: 250, title: '操作', templet: ea.table.tool , fixed:'right',operat:[
                        [{
                            text: '回复',
                            extra:'name',
                            url: init.edit_url,
                            method: 'open',
                            auth: 'edit',
                            class: 'layui-btn layui-btn-xs layui-btn-success',
                            extend: '',
                            _if:function(data,value){
                                if(data.replay == ''){
                                    return true;
                                }else{
                                    return false;
                                }
                            }
                        }]
                    ]},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});